<template>
  <header class="header">
    <van-icon name="arrow-left" @click="goback" />
    <div class="title">{{title}}</div>
    <van-icon name="weapp-nav" />
  </header>
</template>

<script>
import { useRouter, useRoute } from 'vue-router'

export default {
 props: {
    title: {
      type: String,
      default: ''
    }
 },
    setup() {
        const route = useRoute()
        const router = useRouter()
        const goback = () => {
          if(route.path === '/myOrder') {
            router.push('/mine')
          }
           else {
              router.go(-1)
           }
        }
        return {
            goback
        }
    }
};
</script>

<style lang="less" scoped>
.header {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  font-size: 15px;
  height: 30px;
  align-items: center;
  border-bottom:1px solid #DCDCDC ;
  z-index: 10000;
}
</style>